package org.itstack.command;

public class TemperatureCommand implements Command {

    private final AirConditioner ac;
    private final int newTemp;
    //记录前一个温度
    private int prevTemp;

    public TemperatureCommand(AirConditioner ac, int newTemp) {
        this.ac = ac;
        this.newTemp = newTemp;
    }

    @Override
    public void execute() {
        prevTemp = ac.getTemperature();
        ac.setTemperature(newTemp);
    }

    @Override
    public void undo() {
        // TODO Auto-generated method stub
        ac.setTemperature(prevTemp);
        
    }



}
